import axios from "../myaxios/myaxios";

// 获取购物车数据

export const getCartData = () => axios.get("user/cart/queryByUser");

// 提交地址

export const sendAddress = (data) => axios.post("user/address/save", data);

// 获取用户地址
export const getUserAddress = () => axios.get("user/address/queryByUser");

// 获取对应id的地址编辑详情
export const getAddressDetail = (id) => axios.get("user/address/" + id);

// 删除对应id的地址
export const deleteAddress = (id) => axios.delete("user/address/" + id);

// 修改默认地址
export const changeDefaultAddress = (params) =>
  axios.post(`user/address/${params.id}/${params.status}`);

// 购物车加减按钮操作
export const updateCart = (params) =>
  axios.post(`user/cart/update/${params.id}/${params.count}`);

// 删除商品
export const deleteCartGoods = (data) => axios.delete("user/cart", { data });

// 获取提交订单的信息
export const getSubmitOrderMessage = (params) =>
  axios.get("user/order/prepareCheckout", { params: params });

// 提交订单后获取订单号等信息
export const getOrderMessage = (params) =>
  axios.post("user/order/save", null , { params: params });
